home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 April: Mac OS SDK / Dev.CD Apr 00 SDK1.toast / Development Kits / Mac OS / Translation Manager / Sample Code / Translation Extension Example / RoutineDescriptorEntry.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-06-05  |  1.6 KB  |  45 lines  |  [TEXT/CWIE]

  1. /*
  2.     File:        RoutineDescriptorEntry.c 
  3.  
  4.     Contains:    Routine Descriptor for main entry point
  5.     
  6.     Copyright:    © 1994,1998 by Apple Computer, Inc., all rights reserved.
  7.     
  8. */
  9.  
  10. #include <Components.h>
  11.  
  12. // ------------------------------------------------------------------------------------
  13. //
  14. //    IF YOU BUILD A NATIVE POWERPC COMPONENT, YOU MUST USE A ROUTINE DESCRIPTOR INSTEAD
  15. //    OF MAIN() AS YOUR MAIN ENTRY POINT
  16. //
  17. //        A PowerPC code fragment has a well defined entry point. The Component Manager,
  18. //    rather than just jumping to the start of the code resource, will call the main entry
  19. //    point, as defined when linking, instead. But the Component Manager is 68K code, which
  20. //    means your main entry point must be a RoutineDescriptor.
  21. //
  22. //    When you link the component, you must specify MainRD as the entry 
  23. //
  24. //    Note: Your development environment may issue a warning because your main entry point 
  25. //          is in a data section, not a code section. You may ignore the warning.
  26. //    Note: Some components rely on a "fast dispatching" mechanism for calling component 
  27. //          functions. This mechanism is dependent on the 68K architecture and is unsupported
  28. //          for native components
  29.  
  30.  
  31. #ifdef powerc
  32.  
  33. pascal ComponentResult main( ComponentParameters *params, Handle storage );
  34.  
  35. enum {    
  36.     uppMainProcInfo = kPascalStackBased
  37.          | RESULT_SIZE(SIZE_CODE(sizeof(ComponentResult)))
  38.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(ComponentParameters *)))
  39.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(Handle)))
  40.     };
  41.         
  42.     RoutineDescriptor MainRD = BUILD_ROUTINE_DESCRIPTOR(uppMainProcInfo, main);
  43.  
  44.     
  45. #endif